package cn.icanci.ladybird.service.impl;

import cn.icanci.ladybird.pojo.entity.OrderInfoTicketElectronicMiddle;
import cn.icanci.ladybird.dao.OrderInfoTicketElectronicMiddleDao;
import cn.icanci.ladybird.service.OrderInfoTicketElectronicMiddleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (OrderInfoTicketElectronicMiddle)表服务实现类
 *
 * @author makejava
 * @since 2020-09-29 20:34:01
 */
@Service("orderInfoTicketElectronicMiddleService")
public class OrderInfoTicketElectronicMiddleServiceImpl implements OrderInfoTicketElectronicMiddleService {
    @Resource
    private OrderInfoTicketElectronicMiddleDao orderInfoTicketElectronicMiddleDao;

    /**
     * 通过ID查询单条数据
     *
     * @param orderInfoTicketElectronicMiddleId 主键
     * @return 实例对象
     */
    @Override
    public OrderInfoTicketElectronicMiddle queryById(Long orderInfoTicketElectronicMiddleId) {
        return this.orderInfoTicketElectronicMiddleDao.queryById(orderInfoTicketElectronicMiddleId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<OrderInfoTicketElectronicMiddle> queryAllByLimit(int offset, int limit) {
        return this.orderInfoTicketElectronicMiddleDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param orderInfoTicketElectronicMiddle 实例对象
     * @return 实例对象
     */
    @Override
    public OrderInfoTicketElectronicMiddle insert(OrderInfoTicketElectronicMiddle orderInfoTicketElectronicMiddle) {
        this.orderInfoTicketElectronicMiddleDao.insert(orderInfoTicketElectronicMiddle);
        return orderInfoTicketElectronicMiddle;
    }

    /**
     * 修改数据
     *
     * @param orderInfoTicketElectronicMiddle 实例对象
     * @return 实例对象
     */
    @Override
    public OrderInfoTicketElectronicMiddle update(OrderInfoTicketElectronicMiddle orderInfoTicketElectronicMiddle) {
        this.orderInfoTicketElectronicMiddleDao.update(orderInfoTicketElectronicMiddle);
        return this.queryById(orderInfoTicketElectronicMiddle.getOrderInfoTicketElectronicMiddleId());
    }

    /**
     * 通过主键删除数据
     *
     * @param orderInfoTicketElectronicMiddleId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long orderInfoTicketElectronicMiddleId) {
        return this.orderInfoTicketElectronicMiddleDao.deleteById(orderInfoTicketElectronicMiddleId) > 0;
    }
}